package Summative;

import java.util.*;

public class VectorList
{
  
  ArrayList <Vector> vectors;
  ViewPanel panel;
  Menu menu;
  MenuItemList list;
  
  public VectorList(ViewPanel panel, Menu menu, MenuItemList list)
  {
    vectors = new ArrayList <Vector> ();
    panel.setVectorList(this);
    list.setVectorList(this);
    this.panel = panel;
    this.menu = menu;
    this.list = list;
  }
  
  public void addVector(String string)
  {
    try
    {
      Vector vectorB = new Vector(string);
      vectors.add(vectorB);
      list.addJMenuItem();
    }catch(NumberFormatException e)
    {
      System.out.println("You are an idiot... input a proper vector or GTFO");
    }
    catch(ArithmeticException e)//REMOVE LATER AND FIX IN VECTOR PROGRAM!!!!!!!!!!!!!!
    {
      System.out.println("You are an idiot... input a proper vector or GTFO");
    }
    
    panel.update();
  }
  
  public ArrayList <Vector> getArray()
  {
    return vectors;
  }
  
  public Vector getVector(int number)
  {
    return vectors.get(number);
  }
  
  public void addVector(int x, int y, int xF, int yF)
  {
    
  }
}